home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue72 / construc / HitchHiker.pas next >
Encoding:
Pascal/Delphi Source File  |  2001-07-03  |  766 b   |  37 lines

  1. unit HitchHiker;
  2. interface
  3. uses
  4.   InvokeRegistry;
  5.  
  6. type
  7.   IHitchHiker = interface(IInvokable)
  8.     ['{06723E05-662D-11D5-81CE-00104BF89DAD}']
  9.     function TheAnswer: Integer; stdcall;
  10.     function TheQuestion: String; stdcall;
  11.   end;
  12.  
  13.   THitchHiker = class(TInvokableClass, IHitchHiker)
  14.   public
  15.     function TheAnswer: Integer; stdcall;
  16.     function TheQuestion: String; stdcall;
  17.   end;
  18.  
  19. implementation
  20.  
  21. { THitchHiker }
  22.  
  23. function THitchHiker.TheAnswer: Integer;
  24. begin
  25.   Result := 42
  26. end;
  27.  
  28. function THitchHiker.TheQuestion: String;
  29. begin
  30.   Result := 'What do you get when you multiply six by nine?'
  31. end;
  32.  
  33. initialization
  34.   InvRegistry.RegisterInterface(TypeInfo(IHitchHiker));
  35.   InvRegistry.RegisterInvokableClass(THitchHiker)
  36. end.
  37.